Class | A code for the class of device; for example, audio, disk, processor, or network. |
Type | A code for the type of device within its class; for example, FPU and CPU types within the processor class. |
Controller | When applicable, the number of the controller, board, or attachment. |
Unit | When applicable, the logical unit or device within a Controller number. |
State | A descriptive number, such as the CPU model number. |
displays information about disk 4 on controller 1.hinv -c disk -b 1 -u 4
You can use hinv to check the result of installing new hardware. The new hardware should show up in the report after the system is booted following installation, provided that the associated device driver was called and was written correctly.
A full inventory report (hinv -v) is almost mandatory documentation for a software problem report, either submitted by your user to you, or by you to Silicon Graphics.
Example 2-1 : Testing the Hardware Inventory in a Shell Script
if hinv -s -c disk -b 1; then ; else echo No second disk controller; fi ;You can access the inventory table in a C program using the functions documented in the getinvent(3) reference page. The only access method supported is a sequential scan over the table, viewing all entries. Three functions permit access:
The format of one inventory table row is declared as type inventory_t in the sys/invent.h header file. This header file also supplies symbolic names for all the class and type numbers that can appear in the table, as well as containing commentary explaining the meanings of some of the numbers.
Example 2-2 : Function Returning Type Code for CPU Module
#include <stddef.h> /* for NULL */ #include <invent.h> /* includes sys/invent.h */ int getIPtypeCode() { inv_state_t * pstate = NULL; inventory_t * work; int ret = 0; setinvent_r(&pstate); do { work = getinvent_r(pstate); if ( (INV_PROCESSOR == work->inv_class) && (INV_CPUBOARD == work->inv_type) ) ret = work->inv_state; } while (!ret) endinvent_r(pstate); /* releases pstate-> */ return ret; }